﻿using System;

namespace VXCompany.SilverlightLogging.MVVM.Models.SyncBehaviors
{
	/// <summary>
	/// Behavior that generates an exception at Sync. For test purposes only.
	/// </summary>
	public class TestSvcFailureBehavior : PeriodicSync
	{
		/// <summary>
		/// Creates new instance.
		/// </summary>
		public TestSvcFailureBehavior()
			: base(TimeSpan.FromSeconds(5))
		{
		}

		/// <summary>
		/// Throws exception.
		/// </summary>
		protected override void StartImpl()
		{
			SyncAction = () => { throw new Exception("Simulate service failure exception."); };
			base.StartImpl();
		}

		/// <summary>
		/// Returns readable name.
		/// </summary>
		public override string Name
		{
			get
			{
				return "TestSvcFailureBehavior";
			}
		}
	}
}
